<?php
 /**
 * 网站验证码类
 *
 * LICENSE: 
 * @author $Id: Image.php 308 2011-12-27 06:35:46Z kylingood $
 * @since      Release 1.0.0
 * @copyright  Copyright (c) 2010-2011 Mumayi.com Inc. (http://www.mumayi.com)
*/
class	Custom_Captcha_Image extends Zend_Captcha_Image
{
	
	protected $_event = "getCaptcha()";
	
	protected $_directions = "点击图片,换一张";
	
	
	/**
	 * 取得更换图片的JavaScript事件
	 */
	public	function getEvent()
	{
		return $this->_event;
	}

	/**
	 * 取到更换图片说明
	 */
	public	function getDirections()
	{
		return $this->_directions;
	}
	
	/**
	 * 设置JavaScript事件
	 * @param string $event
	 */
	public	function setEvent($event)
	{
		$this->_event = $event;
        return $this;
	}
	
	/**
	 * 设置更换图片说明
	 * @param string $directions
	 */
	public	function setDirections($directions)
	{
		$this->_directions = $directions;
        return $this;
	
	}
	
	
 	public function render(Zend_View_Interface $view = null, $element = null)
    {
    	$img='<img width="'.$this->getWidth().'" onclick="'.$this->getEvent().'" style="cursor:pointer;"  height="'.$this->getHeight().'" alt="'.$this->getImgAlt().'" src="' . $this->getImgUrl() . $this->getId() . $this->getSuffix() . '"/>';
        $hidden='<input type="hidden"  value="'. $this->getId() .'" id="captchaid" name="captchaid" >';
    	$word=$this->getDirections();
    	//$word='';
        $html=$img.$hidden.$word;
        return $html;
    }

}